﻿namespace DB.SchemaSync.Library.Models
{
	public class ExcludeObject
	{
		public ActionType ActionType { get; set; }
		public string Type { get; set; }
		public string Name { get; set; }

		public override string ToString()
		{
			return $"{Type}:{Name}";
		}

		public override bool Equals(object obj)
		{
			ExcludeObject filterObj = obj as ExcludeObject;
			if (filterObj != null)
			{
				return Type.ToLower().Equals(filterObj.Type.ToLower()) && Name.ToLower().Equals(filterObj.Name.ToLower());
			}

			DbObject dbObj = obj as DbObject;
			if (dbObj != null) return Equals(dbObj.GetExcludeObject());

			return false;
		}

		public override int GetHashCode()
		{
			return Type.ToLower().GetHashCode() + Name.ToLower().GetHashCode();
		}
	}
}